Custom functions in Python